#include <iostream>
#include <vector>
#include <map>
#include <string>

class SimpleSubmoduleHelper {
public:
    void showWxWidgetsSubmodules() {
        std::cout << "📋 wxWidgets Submodules Analysis" << std::endl;
        std::cout << "=================================" << std::endl;
        
        std::vector<std::string> submodules = {
            "3rdparty/catch - https://github.com/wxWidgets/Catch.git",
            "3rdparty/libwebp - https://github.com/wxWidgets/libwebp.git", 
            "3rdparty/nanosvg - https://github.com/wxWidgets/nanosvg.git",
            "3rdparty/pcre - https://github.com/wxWidgets/pcre.git",
            "src/expat - https://github.com/wxWidgets/libexpat.git",
            "src/jpeg - https://github.com/wxWidgets/libjpeg-turbo.git",
            "src/png - https://github.com/wxWidgets/libpng.git",
            "src/stc/lexilla - https://github.com/wxWidgets/lexilla.git",
            "src/stc/scintilla - https://github.com/wxWidgets/scintilla.git",
            "src/tiff - https://github.com/wxWidgets/libtiff.git",
            "src/zlib - https://github.com/wxWidgets/zlib.git"
        };
        
        for (const auto& submodule : submodules) {
            std::cout << "  • " << submodule << std::endl;
        }
    }
    
    void generateMirrorCommands() {
        std::cout << "\n🔧 Git Mirror Configuration Commands" << std::endl;
        std::cout << "===================================" << std::endl;
        
        std::map<std::string, std::string> mirrors = {
            {"https://github.com/wxWidgets/libexpat.git", "https://gitee.com/mirrors/libexpat"},
            {"https://github.com/wxWidgets/libpng.git", "https://gitee.com/mirrors/libpng"},
            {"https://github.com/wxWidgets/zlib.git", "https://gitee.com/mirrors/zlib"},
            {"https://github.com/wxWidgets/libtiff.git", "https://gitee.com/mirrors/libtiff"},
            {"https://github.com/wxWidgets/libjpeg-turbo.git", "https://gitee.com/mirrors/libjpeg-turbo"},
            {"https://github.com/wxWidgets/Catch.git", "https://gitee.com/mirrors/Catch"},
            {"https://github.com/wxWidgets/libwebp.git", "https://gitee.com/mirrors/libwebp"},
            {"https://github.com/wxWidgets/nanosvg.git", "https://gitee.com/mirrors/nanosvg"},
            {"https://github.com/wxWidgets/pcre.git", "https://gitee.com/mirrors/pcre"},
            {"https://github.com/wxWidgets/lexilla.git", "https://gitee.com/mirrors/lexilla"},
            {"https://github.com/wxWidgets/scintilla.git", "https://gitee.com/mirrors/scintilla"}
        };
        
        for (const auto& mirror : mirrors) {
            std::cout << "git config --global url." << mirror.second 
                      << ".insteadof " << mirror.first << std::endl;
        }
    }
    
    void showDownloadCommands() {
        std::cout << "\n🚀 Submodule Download Commands" << std::endl;
        std::cout << "==============================" << std::endl;
        std::cout << "cd /d/vc/wxWidgets" << std::endl;
        std::cout << "git submodule update --init --recursive --progress" << std::endl;
        std::cout << "\nOr individually:" << std::endl;
        std::cout << "git submodule update --init src/expat" << std::endl;
        std::cout << "git submodule update --init src/png" << std::endl;
        std::cout << "git submodule update --init src/zlib" << std::endl;
        std::cout << "git submodule update --init src/jpeg" << std::endl;
        std::cout << "git submodule update --init src/tiff" << std::endl;
    }
};

int main() {
    SimpleSubmoduleHelper helper;
    
    std::cout << "=== wxWidgets Submodule Management Helper ===" << std::endl;
    std::cout << std::endl;
    
    helper.showWxWidgetsSubmodules();
    helper.generateMirrorCommands(); 
    helper.showDownloadCommands();
    
    std::cout << "\n==========================================" << std::endl;
    std::cout << "✅ Ready to download wxWidgets submodules!" << std::endl;
    
    return 0;
}
